<ui:composition template="/pages/templates/layout.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="title">Liste des Articles redigés par un  journaliste</ui:define>
	<ui:define name="content">
		<h:form id="form">
			<p:messages id="messages" showDetail="true" autoUpdate="true"
				closable="true" />

			<p:panel id="toggleable"
				header="LISTES DES ARTICLES REDIGES PAR UN JOURNALISTE"
				toggleable="true" toggleSpeed="500" widgetVar="panel">
				<p:fieldset id="saisie" legend="Saisie des informations"
					toggleable="true" toggleSpeed="500">
					<h:panelGrid columns="3" cellpadding="10">

						<p:outputLabel for="journaliste" value="Journaliste" />
						<p:selectOneMenu id="journaliste" required="true"
							value="#{journalisteBean.selectedJournalisteCombo}"
							converter="#{entityConverter}">
							<p:ajax event="valueChange"
								listener="#{journalisteBean.findArticles}" update="table" />
							<f:selectItem itemLabel="Selectionnez" itemValue="" />
							<f:selectItems var="journalist"
								value="#{journalisteBean.journalistes}"
								itemLabel="#{journalist.journalisteNom}"
								itemValue="#{journalist}" />
							<p:ajax update="journalisteMsg" event="keyup" />
						</p:selectOneMenu>
						<p:message id="journalisteMsg" for="journaliste" display="icon" />
					</h:panelGrid>

					<p:separator />

					<p:commandButton value="Imprimer" icon="ui-icon-trash"
						update="@all" styleClass="btImp"
						action="#{journalisteBean.imprimerJournalisteArticles}">
						<p:confirm header="Confirmation" message="Voulez-vous imprimer ?"
							icon="ui-icon-alert" />
					</p:commandButton>

					<p:confirmDialog global="true" showEffect="puff"
						hideEffect="explode">
						<p:commandButton value="Oui" type="button"
							styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
						<p:commandButton value="Non" type="button"
							styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
					</p:confirmDialog>
				</p:fieldset>

				<p:dataTable id="table" var="articls"
					value="#{journalisteBean.articles}" rowKey="#{articls.articleId}"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					paginator="true" rows="10" rowsPerPageTemplate="5,10,15"
					styleClass="table">
					<p:column headerText="Identifiants" styleClass="column">
						<h:outputText value="#{articls.articleId}" />
					</p:column>

					<p:column headerText="Contenus" styleClass="column">
						<h:outputText value="#{articls.articleContenu}" />
					</p:column>
				</p:dataTable>
			</p:panel>
		</h:form>
	</ui:define>
</ui:composition>
